import axiosRequest from "@/api/axiosRequest.ts";

const BaseUrl = '/admin/nav'

const getNavList = (current: number,size:number,navName?:string,status?:number) => axiosRequest({
    url: `${BaseUrl}/getNavList`,
    method: 'GET',
    params: {
        current: current,
        size: size,
        navName: navName,
        status: status
    }
})

const addNav = (nav:Nav) => axiosRequest({
    url: BaseUrl + '/add',
    method: 'POST',
    data: nav
})

const updateNav = (nav:Nav) => axiosRequest({
    url: BaseUrl + '/update',
    method: 'PUT',
    data: nav
})

const deleteNav = (id:number) => axiosRequest({
    url: BaseUrl + '/delete',
    method: 'DELETE',
    params: {
        id: id
    }
})

export const navApi = {
    /* 获取树形菜单列表 */
    getNavTreeList :() => axiosRequest.get(`${BaseUrl}/getNavTree`),
    getNavList,
    addNav,
    updateNav,
    deleteNav
}

